package com.ruoyi.pingan.fymodule.thirdpa.controller;



import cn.dev33.satoken.annotation.SaIgnore;
import com.ruoyi.pingan.fymodule.thirdpa.model.dto.*;
import com.ruoyi.pingan.fymodule.thirdpa.model.vo.*;
import com.ruoyi.pingan.fymodule.thirdpa.service.PaMemberService;
import com.ruoyi.pingan.fymodule.thirdpa.util.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.net.SocketException;


@Slf4j
@Tag(name = "会员注册绑定")
@RestController
@RequestMapping("/thirdpa/member")
public class PaMemberController extends BaseController {

    @Autowired
    private PaMemberService paMemberService;


    @SaIgnore
    @Operation(summary = "实名开户(个体工商、企业工商户)")
    @PostMapping(value = "/autonymOpenCustAcctInd")
    public CommonResult<AutonymOpenCustAcctVo> autonymOpenCustAcctInd(@RequestBody AutonymOpenCustAcctDto dto){
        return CommonResult.success(paMemberService.autonymOpenCustAcctInd(dto));
    }

    @Operation(summary = "登记行为记录")
    @PostMapping(value = "/registerBehavior")
    public CommonResult<RegisterBehaviorRecordVo> registerBehavior(@RequestBody RegisterBehaviorRecordDto dto) throws SocketException {
        return CommonResult.success(paMemberService.registerBehavior(dto));
    }

    @Operation(summary = "会员绑定提现账户小额鉴权-校验法人")
    @PostMapping(value = "/bindSmallAmountWithCheckCorp")
    public CommonResult<BindSmallAmountWithCheckCorpVo> bindSmallAmountWithCheckCorp(@RequestBody BindSmallAmountWithCheckCorpDto dto){
        return CommonResult.success(paMemberService.bindSmallAmountWithCheckCorp(dto));
    }

    @Operation(summary = "小额鉴权回填金额-校验法人")
    @PostMapping(value = "/checkAmountWithCorp")
    public CommonResult<BindSmallAmountWithCheckCorpVo> CheckAmountWithCorp(@RequestBody BindSmallAmountWithCheckCorpDto dto){
        return CommonResult.success(paMemberService.checkAmountWithCorp(dto));
    }

    @Operation(summary = "会员解绑提现账户")
    @PostMapping(value = "/unbindRelateAcct")
    public CommonResult<UnbindRelateAcctVo> unbindRelateAcct(@RequestBody UnbindRelateAcctDto dto){
        return CommonResult.success(paMemberService.unbindRelateAcct(dto));
    }

    @Operation(summary = "查询小额鉴权转账结果")
    @PostMapping(value = "/smallAmountTransferQuery")
    public CommonResult<SmallAmountTransferQueryVo> smallAmountTransferQuery(@RequestBody UnbindRelateAcctDto dto){
        return CommonResult.success(paMemberService.smallAmountTransferQuery(dto));
    }

    @Operation(summary = "见证子台帐信息查询")
    @PostMapping(value = "/eJZBCustInformationQuery")
    public CommonResult<Object> eJZBCustInformationQuery(@RequestBody EJZBCustInformationQueryDto dto){
        return CommonResult.success(paMemberService.eJZBCustInformationQuery(dto));
    }

    @Operation(summary = "会员绑定信息查询")
    @PostMapping(value = "/memberBindQuery")
    public CommonResult<Object> memberBindQuery(@RequestBody MemberBindQueryDto dto){
        return CommonResult.success(paMemberService.memberBindQuery(dto));
    }

    @Operation(summary = "根据会员代码查询会员子账号")
    @GetMapping(value = "/queryCustAcctIdByThirdCustId")
    public CommonResult<Object> queryCustAcctIdByThirdCustId(String tranNetMemberCode){
        return CommonResult.success(paMemberService.queryCustAcctIdByThirdCustId(tranNetMemberCode));
    }

    @Operation(summary = "维护会员绑定提现账户联行号")
    @PostMapping(value = "/mntMbrBindRelateAcctBankCode")
    public CommonResult<BaseVo> mntMbrBindRelateAcctBankCode(@RequestBody MntMbrBindRelateAcctBankCodeDto dto){
        return CommonResult.success(paMemberService.mntMbrBindRelateAcctBankCode(dto));
    }

    @Operation(summary = "申请修改手机号码")
    @PostMapping(value = "/applyForChangeOfCellPhoneNum")
    public CommonResult<ApplyForChangeOfCellPhoneNumVo> applyForChangeOfCellPhoneNum(@RequestBody ApplyForChangeOfCellPhoneNumDto dto){
        return CommonResult.success(paMemberService.applyForChangeOfCellPhoneNum(dto));
    }

    @Operation(summary = "查询银行子账户余额")
    @PostMapping(value = "/custAcctIdBalanceQuery")
    public CommonResult<Object> custAcctIdBalanceQuery(@RequestBody CustAcctIdBalanceQueryDto dto){
        return CommonResult.success(paMemberService.custAcctIdBalanceQuery(dto));
    }

    @Operation(summary = "实名开户(存个体)")
    @PostMapping(value = "/autonymOpenCustAcctPerson")
    public CommonResult<AutonymOpenCustAcctVo> autonymOpenCustAcctPerson(@RequestBody AutonymOpenCustAcctDto dto){
        return CommonResult.success(paMemberService.autonymOpenCustAcctPerson(dto));
    }

    @Operation(summary = "会员绑定提现账户银联鉴权-校验法人")
    @PostMapping(value = "/bindUnionPayWithCheckCorp")
    public CommonResult<BindUnionPayWithCheckCorpVo> bindUnionPayWithCheckCorp(@RequestBody BindUnionPayWithCheckCorpDto dto){
        return CommonResult.success(paMemberService.bindUnionPayWithCheckCorp(dto));
    }

    @Operation(summary = "银联鉴权回填短信码-校验法人")
    @PostMapping(value = "/checkMsgCodeWithCorp")
    public CommonResult<CheckMsgCodeWithCorpVo> checkMsgCodeWithCorp(@RequestBody CheckMsgCodeWithCorpDto dto){
        return CommonResult.success(paMemberService.checkMsgCodeWithCorp(dto));
    }




    @Operation(summary = "查询冻结充值订单信息")
    @PostMapping(value = "/queryCrowdAcountMsg")
    public CommonResult<CrowdAcountMsgQueryVo> queryCrowdAcountMsg(@RequestBody CrowdAcountMsgQueryDto dto){
        return CommonResult.success(paMemberService.queryCrowdAcountMsg(dto));
    }

}
